FROM debian:base
LABEL maintainer "Bitnami <containers@bitnami.com>"

ENV PATH="/usr/local/elasticsearch/bin:$PATH" \
    DOWNLOAD_URL="https://artifacts.elastic.co/downloads/elasticsearch"

ARG ELASTICSEARCH_PLUGINS=""

RUN . /usr/local/scripts/libcomponent.sh && component_unpack "elasticsearch-7.6.2-linux-x86_64" ${DOWNLOAD_URL} "tar.gz" && \
    ln -sf /usr/local/elasticsearch-7.6.2 /usr/local/elasticsearch

#RUN chmod g+rwX /opt/bitnami
#
COPY rootfs /
RUN /usr/local/scripts/elasticsearch/postunpack.sh
ENV BITNAMI_APP_NAME="elasticsearch" \
    BITNAMI_IMAGE_VERSION="7.6.2-debian-10-r1"
#    JAVA_HOME="/opt/bitnami/java" \
#    LD_LIBRARY_PATH="/opt/bitnami/elasticsearch/jdk/lib:/opt/bitnami/elasticsearch/jdk/lib/server:$LD_LIBRARY_PATH"

EXPOSE 9200 9300

USER 1001
ENTRYPOINT [ "/usr/local/scripts/elasticsearch/entrypoint.sh" ]
CMD [ "/usr/local/scripts/elasticsearch/run.sh" ]
